﻿<?php
include ("../lib/BLL/DonViCTDTBLL.php");

$thongbao="";
$donvi_ctdtBLL = new DonViCTDTBLL();

////////////////////////////////////////////////////////////////////////////////
$ds = $donvi_ctdtBLL->getListDonViCTDT();

$id = $_GET['id'];

$madv = $_POST['madv'];
$mactdt = $_POST['mactdt'];
$ngaybd = $_POST['ngaybd'];
$tinhtrang = $_POST['tinhtrang'];
  
$hien =  $donvi_ctdtBLL -> getDonViCTDT($id);
$madvhien = $hien['ma_donvi'];
$mactdthien = $hien['ma_ctdt'];
$ngaybdhien = $hien['ngaybatdau'];
$tinhtranghien = $hien['tinhtrang'];

$dv_ctdt = new DonViCTDT();
$dv_ctdt -> setDonViCTDT($id,$mactdt,$madv,$ngaybd,$tinhtrang);
$kq = $donvi_ctdtBLL ->UpdateDonViCTDT($dv_ctdt);
      
if($kq)
{
    header("Location: ?muc=nhom3&modul=tbl_donvi_ctdt&action=dsdonvictdt");
}   

/////////////////////////////////
include ("../lib/BLL/DonViBLL.php");
include ("../lib/BLL/ChuongTrinhDaoTaoBLL.php");

$donviBLL = new DonViBLL();
$ctdtBLL = new ChuongTrinhDaoTaoBLL();

$dsdonvi = $donviBLL->GetlistDonVi();
$smarty->assign('ds_donvi',$dsdonvi);

$dsctdt = $ctdtBLL->getAllCTDT();
$smarty->assign('ds_ctdt',$dsctdt);
///////////////////////////////////

$smarty -> assign('id',$id);
$smarty -> assign('madv',$madv);
$smarty -> assign('mactdt',$mactdt);
$smarty -> assign('ngaybd',$ngaybd);
$smarty -> assign('tinhtrang',$tinhtrang);

$smarty -> assign('madvhien',$madvhien);
$smarty -> assign('mactdthien',$mactdthien);
$smarty -> assign('ngaybdhien',$ngaybdhien);
$smarty -> assign('tinhtranghien',$tinhtranghien);

$smarty -> assign('thongbao',$thongbao);
$smarty -> assign('ds_dv_ctdt', $ds);
$smarty->display('nhom3/tbl_donvi_ctdt/suadonvi_ctdt.tpl')
?>